package pack

import (
	"mall_admin_api/biz/model"
	"mall_admin_api/biz/model/admin_product_material_group"
)

func GetProductMaterialGroupList(list []*model.ProductMaterialGroup) []*admin_product_material_group.MaterialGroup {
	var data = make([]*admin_product_material_group.MaterialGroup, 0)
	if len(list) == 0 {
		return data
	}
	for _, item := range list {
		if tmp := ProductMaterialGroup(item); tmp != nil {
			data = append(data, tmp)
		}
	}
	return data
}

func ProductMaterialGroup(data *model.ProductMaterialGroup) *admin_product_material_group.MaterialGroup {
	var info = admin_product_material_group.NewMaterialGroup()
	if data == nil {
		return info
	}
	info.ID = data.ID
	info.Name = data.Name
	return info
}
